<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue计算属性</title>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
</head>
<body>
<div id="app">
    <p>currentTime1: {{currentTime1()}}</p>
    <p>currentTime2: {{currentTime2}}</p>
</div>

<script>
    let vue = new Vue({
        el: "#app",
        data: {
            message: "hello,vue"
        },
        methods: {
            currentTime1: function () {
                return Date.now();
            }
        },
        // 计算属性
        computed: {
            currentTime2: function () {
                this.message;
                return Date.now();
            }
        }
    })
</script>

</body>
</html>